#ifndef EDITWIDGET_H
#define EDITWIDGET_H

#include <QtGui>
#include <QtSql>
#include "charswidget.h"
#include "ui_editwidget.h"

class EditWidget: public QWidget, private Ui::EditWidget
{
Q_OBJECT

public:

EditWidget( QMap<QString, QStringList> albums_attrs );
~EditWidget();

public slots:

void set_record( QSqlRecord record,
                 QModelIndex index,
                 QString opened_album );
void new_record( QString opened_album );
void save_clicked();
void show_chars();
QSqlRecord read_record( QSqlRecord record );

signals:

void record_to_commit( QSqlRecord record,
                      QModelIndex index,
                      bool new_record,
                      bool fast_update );

private:

QMap<QString, QStringList> opened_album_attrs;
QSqlRecord current_record;
QModelIndex current_index;
bool is_new;
void writeSettings();
void readSettings();

protected:

void closeEvent( QCloseEvent * e );

};

#endif // EDITWIDGET_H
